Repository navigation
Conversation
tmleman
requested review from
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
mmaka1 and
plbossart
as code owners
November 18, 2026 15:13
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The audio buffer test target is missing ${SOF_ROOT}/src/platform/posix/include, causing compilation to fail before tests run when CONFIG_SOF_FULL_ZEPHYR_APPLICATION=n.
1 open issue
What changed in this PR
Adds a native_sim ztest suite for SOF component buffers, consolidating coverage from four CMocka test files with fewer linked dependencies.
Changes:
- Adds nine cases covering allocation, read/write behavior, full buffers, overwrite wrapping, and copy limits.
- Shares allocation and empty-buffer assertion helpers and links eleven SOF sources.
- Routes buffer allocations through the host heap for sanitizer visibility.
| File | Description |
|---|---|
test/ztest/unit/audio/buffer/testcase.yaml |
Registers the buffer suite for native_sim. |
test/ztest/unit/audio/buffer/test_buffer_ztest.c |
Implements nine buffer tests and shared helpers. |
test/ztest/unit/audio/buffer/prj.conf |
Enables ztest and host-heap allocation. |
test/ztest/unit/audio/buffer/CMakeLists.txt |
Defines the test target, source dependencies, and sanitizer stack options. |
Review effort: Balanced
| target_include_directories(app PRIVATE | ||
| ${SOF_ROOT}/zephyr/include | ||
| ${SOF_ROOT}/src/include | ||
| ${SOF_ROOT}/src/kernel/platform/posix/include |
PR 11488: test resultsRun date: 2026-11-18 15:44 UTC Tested commit: fe585630d7721f18da92da4e0c12cb30acd2df5e |
Add a ztest suite for the component buffer, merging the four CMocka buffer tests into one suite of nine cases: allocation, a write and read back, filling a buffer completely, wrap around on overwrite, and the five copy size and over/underrun cases. The CMocka builds link twenty one SOF sources and two mock files each. Only eleven sources are actually needed here, so the pipeline, component and IPC3 topology code are dropped along with the notifier mocks. The repeated buffer allocation and empty buffer checks are factored into two helpers. Buffers allocated with a NULL mod_alloc_ctx come from the SOF heap rather than the module allocator, so the suite needs no allocator hook. With the heap routed to the host malloc(), LSan covers the frees instead. Assisted-by: Copilot:claude-opus-5 Signed-off-by: Tomasz Leman <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add a ztest suite for the component buffer, merging the four CMocka buffer tests into one suite of nine cases: allocation, a write and read back, filling a buffer completely, wrap around on overwrite, and the five copy size and over/underrun cases.
The CMocka builds link twenty one SOF sources and two mock files each. Only eleven sources are actually needed here, so the pipeline, component and IPC3 topology code are dropped along with the notifier mocks. The repeated buffer allocation and empty buffer checks are factored into two helpers.
Buffers allocated with a NULL mod_alloc_ctx come from the SOF heap rather than the module allocator, so the suite needs no allocator hook. With the heap routed to the host malloc(), LSan covers the frees instead.
Assisted-by: Copilot:claude-opus-5